www.gusucode.com > 星梦奇缘交友网 1 > 星梦奇缘交友网 1.0源码程序/love/UserArticle.asp

    <!--#include file=conn.asp-->
<!--#include file=config.asp-->
<!--#include file=const.asp-->
<!--#include file=char.asp-->
<!--#include file=inc/ubbcode.asp-->
<%
 '=========================================================
' File: userarticle.asp
' Version:3.0
' Date: 2005-8-30
' Script Written by xmrxw
'=========================================================
' Copyright (C) 2004,2005 920520.com All rights reserved.
' Web: http://www.920520.com,http://www.xmzxw.com
' Email: info@mssky.com,super@mssky.com
' QQ:10689579 Msn:zdlmicr@hotmail.com
'=========================================================
response.buffer=true
stats="文章列表"
call nav()
if not founduser then
	Errmsg=Errmsg+"<br>"+"<li>您还没有登陆,无权限管理文章。"
	founderr=true
end if

if founderr then
	call Mslove_error()
else
call tumppages()'翻页处理
strFileName="UserArticle.asp?"
Select Case Trim(Request("action"))
	Case "删除"
		Stats="删除文章"
		Call delet()
	Case "清空"
		Stats="清空文章"
		Call Alldelet()
	case else
		call main()
End Select
if founderr then call Mslove_error()
end if
call activeonline()
call footer()

sub main()%>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <form action="UserArticle.asp" method=POST name="theForm">
    <tr align="left"> 
      <th height="28" colspan="8" align="center"  class=tablebody1>我的文章</th>
    </tr>
    <tr align="center"> 
      <td width="4%" height="28"  class=tablebody2>状态</td>
      <td width="42%"  class=tablebody2>标 题</td>
      <td width="7%"  class=tablebody2>人气</td>
      <td width="7%"  class=tablebody2>评论</td>
      <td width="6%"  class=tablebody2>修改</td>
      <td width="24%"  class=tablebody2>最后更新</td>
      <td width="5%"  class=tablebody2>属性</td>
      <td width="5%"  class=tablebody2>操作</td>
    </tr>
	<%dim Aid,Istop,Lastpostlist,Tid,locktopic
	set rs=server.createobject("adodb.recordset")
    sql="select id,Tid,title,Username,Hits,Userdis,Istop,LastPost,Addtime,LastTime,locktopic from Ms_Article where Username='"&Trim(membername)&"' order by Istop desc,LastTime desc"
	rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
call rspages()
do while not rs.eof and page_count<Cint(MaxPerPage)
Aid=rs("id")
Istop=rs("Istop")
Lastpostlist=rs("LastPost")
Tid=rs("Tid")
locktopic=rs("locktopic")%>
    <tr align="center"> 
      <td width="4%" height="30" align="center"  class=tablebody2><%if Istop=2 then
	response.Write("<img src=Skins/Default/istop.gif>")
	elseif Istop=1 then
	response.Write("<img src=Skins/Default/isbest.gif>")
	elseif Istop=0 then
	response.Write("<img src=Skins/Default/folder.gif>")
	end if%></td>
      <td width="42%" align="left"  class=tablebody1><%response.write("<a href=dispArt.asp?Tid="&Tid&"&AID="&split(Lastpostlist,"$")(4)&" title=""主题:"&rs("Title")&Brstrt&"作者:"&rs("Username")&Brstrt&"发表于:"&rs("Addtime")&""" target=_blank>"&left(rs("Title"),22)&"</a>")
	  if datediff("d",rs("Addtime"),date())<1 then
response.write("&nbsp;<img src=images/new.gif>")
end if%></td>
      <td width="7%" align="center"  class=tablebody2><%=rs("Hits")%></td>
      <td width="7%" align="center"  class=tablebody1><%=rs("Userdis")%></td>
      <td width="6%" align="center"  class=tablebody1><a href=artpost.asp?action=edit&Tid=<%=Tid%>&Aid=<%=Aid%>>修改</a></td>
      <td width="24%" align="left"  class=tablebody2><%=split(Lastpostlist,"$")(2)%> <font color="#FF0000">|</font> 
      <a href=dispuser.asp?username=<%=split(Lastpostlist,"$")(0)%>><%=split(Lastpostlist,"$")(0)%></a></td>
      <td width="5%" align="center"  class=tablebody1>
<%if locktopic=2 then
	response.write("屏弃")
	elseif locktopic=1 then
	response.Write("<font color=red>锁定</font>")
	else
	response.write("正常")
	end if%>
      </td>
      <td width="5%" align="center"  class=tablebody1><input type=checkbox name=id value=<%=Aid%>></td>
    </tr>
	<%page_count=page_count+1
	rs.movenext
  loop
  else
  response.write("<tr align=""center""><td height=""30"" colspan=""8"" align=""center""  class=tablebody1>无记录!</td></tr>")
  end if
  rs.close
  %>
    <tr align="center"> 
      <td height="31" colspan="8" align="left"  class=tablebody2><%if totalrec>0 then
		  	call showpage(strFileName)
		  end if%></td>
    </tr>
    <tr align="right"> 
      <td height="29" colspan="8"  class=tablebody1> 
        <input type=checkbox name=chkall value=on onclick="CheckAll(this.form)">
        选中所有显示记录 
        <input name=action type=submit id="action" onclick="{if(confirm('确定删除选定的记录吗?')){this.document.theForm.submit();return true;}return false;}" value="删除">
        <input name=action type=submit id="action" onclick="{if(confirm('确定清空所有记录吗?')){this.document.theForm.submit();return true;}return false;}" value="清空"> 
      </td>
    </tr>
    <tr align="center">
      <td height="26" colspan="8" align="left"  class=tablebody1>&nbsp;</td>
    </tr>
  </form>
</table>
<%
end sub

sub delet()''删除选定记录
if Cint(GroupSetting(20))=0 then
Errmsg=Errmsg+"<li>"+"对不起,您没有删除文章的权限。"
Founderr=true
end if
dim delid,FixID,splitid
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
splitid=split(delid,",")
splitid=ubound(splitid)
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
End If
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"错误的参数。"
Founderr=true
end if

if founderr=true then exit sub
conn.execute("update Ms_setup set UserArt=UserArt-"&(splitid+1)&" where Cid=1")
conn.execute("update Ms_user set UserArt=UserArt-"&(splitid+1)&",UserWealth=UserWealth-"&(Cint(GroupSetting(18))*(splitid+1))&" where Username='"&trim(membername)&"'")
conn.execute("delete from Ms_Article where Username='"&trim(membername)&"' and id in("&delid&")")
conn.execute("update Ms_Writer set Article=Article-"&(splitid+1)&" where Username='"&trim(membername)&"' and ClassID=2")
conn.execute("delete from Ms_diaryb where ClassID=2 and Tid in("&delid&")")
sucmsg=sucmsg+"<br>"+"<li>您已成功删除所选记录。"
	call Mslove_suc()
end sub

sub Alldelet()''清空记录
dim delid
delid=0
if Cint(GroupSetting(20))=0 then
Errmsg=Errmsg+"<li>"+"对不起,您没有删除文章的权限。"
Founderr=true
end if
set rs=server.createobject("adodb.recordset")
sql="select id from Ms_Article where Username='"&trim(membername)&"'"
rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
do while not rs.eof
if delid=0 then
delid=rs("id")
else
delid=delid&","&rs("id")
end if
rs.movenext
loop
rs.close
end if
conn.execute("update Ms_setup set Userart=Userart-"&Countart&" where Cid=1")
conn.execute("update Ms_user set Userart=Userart-"&Countart&",UserWealth=UserWealth-"&(Cint(GroupSetting(18))*Countart)&" where  Username='"&trim(membername)&"'")
conn.execute("delete from Ms_Article where Username='"&trim(membername)&"'")
conn.execute("update Ms_Writer set Article=0 where Username='"&trim(membername)&"' and ClassID=2")
conn.execute("delete from Ms_diaryb where ClassID=2 and Tid in("&delid&")")
sucmsg=sucmsg+"<br>"+"<li>您已成功清空所有文章。"
	call Mslove_suc()
end sub
%>   
</body>
</html>